import { createRouter, createWebHashHistory } from 'vue-router'
import Main from '../components/main.vue'
import webdate from '../views/webdate.vue'
import search from '../views/search.vue'
import compare from '../views/compare.vue'
import login from '../views/login.vue'
import user from '../views/user.vue'
import ClusterProducts from '../views/ClusterProducts.vue'

const routes = [
  {
    path: '/',
    redirect: '/main' // 添加重定向，将根路径重定向到 /main
  },
  {
    path: '/main',
    component: Main,
  },
  {
    path: '/webdate',
    component: webdate,
  },
  {
    path: '/search',
    component: search,
  },
  {
    path: '/compare',
    component: compare,
  },
  {
    path: '/cluster',
    component: ClusterProducts,
  },
  {
    path: '/login',
    component: login,
  },
  {
    path: '/user',
    component: user,
  },
  
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router
